package cauca.scsn.modelo.entidad;

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cauca.scsn.modelo.entidad.id.AsignacionConductorId;

/**
 * AsignacionConductor entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "asignacion_conductor", schema = "public")
public class AsignacionConductor extends EntidadGenerica {

	// Fields

	private AsignacionConductorId id;
	private VehiculoEmpleado vehiculoEmpleado;
	private Date fechaInicial;
	private Date fechaFinal;
	private String motivo;

	// Constructors

	/** default constructor */
	public AsignacionConductor() {
	}

	/** minimal constructor */
	public AsignacionConductor(AsignacionConductorId id,
			VehiculoEmpleado vehiculoEmpleado, Date fechaInicial,
			String motivo, String status) {
		this.id = id;
		this.vehiculoEmpleado = vehiculoEmpleado;
		this.fechaInicial = fechaInicial;
		this.motivo = motivo;
		this.status = status;
	}

	/** full constructor */
	public AsignacionConductor(AsignacionConductorId id,
			VehiculoEmpleado vehiculoEmpleado, Date fechaInicial,
			Date fechaFinal, String motivo, String status) {
		this.id = id;
		this.vehiculoEmpleado = vehiculoEmpleado;
		this.fechaInicial = fechaInicial;
		this.fechaFinal = fechaFinal;
		this.motivo = motivo;
		this.status = status;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "idVehiculo", column = @Column(name = "id_vehiculo", nullable = false)),
			@AttributeOverride(name = "cedulaEmpleado", column = @Column(name = "cedula_empleado", nullable = false, length = 10)),
			@AttributeOverride(name = "idAsignacionConductor", column = @Column(name = "id_asignacion_conductor", nullable = false)) })
	public AsignacionConductorId getId() {
		return this.id;
	}

	public void setId(AsignacionConductorId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({
			@JoinColumn(name = "id_vehiculo", referencedColumnName = "id_vehiculo", nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "cedula_empleado", referencedColumnName = "cedula_empleado", nullable = false, insertable = false, updatable = false) })
	public VehiculoEmpleado getVehiculoEmpleado() {
		return this.vehiculoEmpleado;
	}

	public void setVehiculoEmpleado(VehiculoEmpleado vehiculoEmpleado) {
		this.vehiculoEmpleado = vehiculoEmpleado;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "fecha_inicial", nullable = false, length = 13)
	public Date getFechaInicial() {
		return this.fechaInicial;
	}

	public void setFechaInicial(Date fechaInicial) {
		this.fechaInicial = fechaInicial;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "fecha_final", length = 13)
	public Date getFechaFinal() {
		return this.fechaFinal;
	}

	public void setFechaFinal(Date fechaFinal) {
		this.fechaFinal = fechaFinal;
	}

	@Column(name = "motivo", nullable = false)
	public String getMotivo() {
		return this.motivo;
	}

	public void setMotivo(String motivo) {
		this.motivo = motivo;
	}

	@Column(name = "status", nullable = false, length = 1)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Override
	public Object getPrimaryKey() {
		return this.id;
	}

	@Override
	public String toString() {
		return null;
	}

}